<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<title>audio</title>
	</head>
	<body>
		
		<div style="height:100px;" ></div>
		
<audio src="../audios/open.ogg" id="sound" autobuffer autoplay  controls >  
   Your browser does not support the <code>audio</code> element.  
</audio> 	
	<!--
<audio src="../audios/battle.mp3" id="sound" autobuffer autoplay  controls >  
   Your browser does not support the <code>audio</code> element.  
</audio> 
	-->
		<button id="play">play</button>
		<button id="pause">pause</button>
		<button id="mute">mute</button>
		<button id="on">on</button>
		<script>
			
			//var audio = new Audio( "../audios/battle.ogg" );
			
			audio = document.getElementById( "sound" );
			//audio.volume = 1;
			
			audio.addEventListener( "ended", function(){
				console.debug( "ended"  );
			}, false );
			audio.addEventListener( "durationchange", function(){
				//console.debug( "durationchange"  );
			}, false );			
			audio.addEventListener( "emptied", function(){
				console.debug( "emptied"  );
			}, false );					
			audio.addEventListener( "emptied", function(){
				console.debug( "emptied"  );
			}, false );		
			audio.addEventListener( "play", function(){
				console.debug( "play"  );
			}, false );		
			audio.addEventListener( "playing", function(){
				console.debug( "playing"  );
			}, false );								
			audio.addEventListener( "ratechange", function(){
				console.debug( "ratechange"  );
			}, false );								
			audio.addEventListener( "readystatechange", function(){
				console.debug( "readystatechange"  );
			}, false );	
			audio.addEventListener( "seeked", function(){
				console.debug( "seeked"  );
			}, false );							
			audio.addEventListener( "seeking", function(){
				console.debug( "seeking"  );
			}, false );		
			audio.addEventListener( "timeupdate", function(){
				//播放时间改变就会触发该事件
				//console.debug( "timeupdate"  );
			}, false );								
			audio.addEventListener( "volumechange", function(){
				console.debug( "volumechange"  );
			}, false );			
			audio.addEventListener( "waiting", function(){
				console.debug( "waiting"  );
			}, false );			
			audio.addEventListener( "suspend", function(){
				console.debug( "suspend"  );
			}, false );									
			audio.addEventListener( "stalled", function(){
				console.debug( "stalled"  );
			}, false );						
						
			document.getElementById( "play" ).onclick = function(){
				//audio.load();
				audio.play();
			}
			document.getElementById( "pause" ).onclick = function(){
				audio.pause();
			}
			document.getElementById( "mute" ).onclick = function(){
				audio.muted = true;
			}					
			document.getElementById( "on" ).onclick = function(){
				audio.muted = false;
			}			
			
		</script>
	</body>
</html>
